﻿using System;
using System.Collections.Generic;
using System.Text;

namespace WebCrawlerTools
{
    class SKey : SNode
    {
        public SKey()
        {
            type = CNodeType.SKey;
        }

        public SKey(string text)
        {
            this.Content = text;
            type = CNodeType.SKey;
        }

        public bool IsFind()
        {
            return startPos >= 0;
        }

        public bool Find(ref String src,int startFindPos)
        {
            startPos = src.IndexOf(Content, startFindPos);
            endPos = startPos + Content.Length;
            return startPos!=-1;
        }
        public override void reset()
        {
            this.StartPos = -1;
            this.EndPos = -1;
        }
        /// <returns>現在の <see cref="T:System.Object"/> を表す <see cref="T:System.String"/>。</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("SKey[Text:");
            sb.Append(Content);
            sb.Append("][StartPos:");
            sb.Append(startPos);
            sb.Append("]");
            return sb.ToString();
        }

    }
}
